import 'package:confuse_util/controller/zys_input_controller.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class ZysInput extends StatefulWidget {
  final String? labText;
  final String? bodyText;
  final String? buttonTips;
  const ZysInput({
    super.key,
    this.labText = "",
    this.bodyText = "",
    this.buttonTips = "",
  });

  @override
  State<ZysInput> createState() => _ZysInputState();
}

class _ZysInputState extends State<ZysInput> {
  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.all(16.0),
      child: SizedBox(
        width: 300,
        child: TextField(
          readOnly: true,
          decoration: InputDecoration(
            labelText: widget.labText,
            border: OutlineInputBorder(),
            filled: true,
            fillColor: Colors.grey[200],
            suffixIcon: IconButton(
              icon: const Icon(Icons.copy),
              onPressed: () => ZysInputController.copyToClipboard(widget.bodyText, context),
              tooltip: '复制',
            ),
          ),
          controller: TextEditingController(text: widget.bodyText),
        ),
      ),
    );
  }
}



